(function()
{

    var getUrlVars = function(url)
	{
	    var vars = [], hash, i;
	    var hashes = url.slice(url.indexOf('?') + 1).split('&');
	    for(i = 0; i < hashes.length; i++)
	    {
	        hash = hashes[i].split('=');
	        vars.push(hash[0]);
	        vars[hash[0]] = hash[1];
	    }
	    return vars;
	}

    var scripts = document.getElementsByTagName('script');
	var scriptTag = scripts[scripts.length - 1];
	var GET = getUrlVars(scriptTag.src);
 	var ROOT_HTTP = scriptTag.src.split('?')[0].replace('/assets/js/Tv_Arte_IFrame.js', '');
    var url = ROOT_HTTP + '/render/'
		+ '?id=' + GET.id
		+ '&lang=' + GET.lang;
    var iFrame = document.createElement('iframe');
		iFrame.setAttribute('src', url);
		iFrame.setAttribute('id', 'arte-header');
		iFrame.setAttribute('allowtransparency', 'true');
		iFrame.setAttribute('frameBorder', '0');
		iFrame.setAttribute('scrolling', 'no');
	document.body.insertBefore(iFrame, document.body.childNodes[0]);
	
    var cssLink = document.createElement('link');
		cssLink.setAttribute('type', 'text/css');
		cssLink.setAttribute('href', ROOT_HTTP + '/assets/css/render-iframe' + ((navigator.appName.toString().indexOf('Microsoft') != -1) ? '_ie' : '') +'.css');
		cssLink.setAttribute('rel', 'stylesheet');
		cssLink.setAttribute('media', 'all');
	document.getElementsByTagName('head')[0].appendChild(cssLink);

})();